package com.swak.hash;

import com.swak.utils.Hashs;

/**
 * 最主要的一块是 Hash 算法： <br>
 * 1. 均衡 <br>
 * 2. 局部数据的分散，也就是热点分离 <br>
 * 
 * @author lifeng
 */
public class HashAlg {

	public static void main(String[] args) {
		long[] longs = { 1501847864203153408L, 1501847864203153409L, 1501847864203153410L, 1501847864203153411L,
				1501847864203153412L, 1501847864203153413L, 1501847864203153414L, 1501847864203153415L };
		for (long id : longs) {
			System.out.print(id + ":" + id % 8);
			System.out.print(" ");
			System.out.print(Hashs.hashCode(id) + ":" + Hashs.hashCode(id) % 8);
			System.out.print(" ");
			System.out.print(Hashs.hashCode2(id) + ":" + Hashs.hashCode2(id) % 8);
			System.out.println();
		}
	}
}
